package com.atguigu;

import com.atguigu.ba02.School;
import com.atguigu.ba02.Student;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyTest02 {

    @Test
    public void test01() {
        String config = "ba02/total.xml";
        ApplicationContext ctx = new ClassPathXmlApplicationContext(config);

        Student myStudent = (Student) ctx.getBean("myStudent");
        System.out.println("Student对象=" + myStudent);

    }

    @Test
    public void test02() {
        Student student = new Student();
        student.setName("libai");
        student.setAge(20);

        School school = new School();
        school.setName("上海大学");
        school.setAddress("徐家汇");

        student.setSchool(school);

        System.out.println("student==" + student);
    }

}
